package com.itjcloud.iot.gateway.filter;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.gateway.filter.headers.HttpHeadersFilter;
import org.springframework.http.HttpHeaders;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;


/**
 * 筛选请求头
 */
@Component
public class HttpHeadersApplicationNameRequestFilter implements HttpHeadersFilter {

    @Value("${spring.application.name}")
    private String applicationName;

    @Override
    public HttpHeaders filter(HttpHeaders input, ServerWebExchange exchange) {
        input.add("Application-Name", applicationName);
        return input;

    }


}
